package com.healthcloud.thread;


import com.healthcloud.entity.RegionalDisease.ChronicGroupEnity;
import com.healthcloud.service.RegionalDisease.TestprojectitemmonitorService;
import com.healthcloud.utils.SpringUtil;

/**
 * Created by yucl on 2017/12/8.
 */
public class MyThread1 implements Runnable {

    private ChronicGroupEnity entity;
    private String            testKindCode;
    private String            year;
    private String            areaCode;
    private String            level;

    public MyThread1(ChronicGroupEnity entity, String testKindCode, String year, String areaCode, String level){
        this.entity = entity;
        this.testKindCode=testKindCode;
        this.year=year;
        this.areaCode=areaCode;
        this.level=level;
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {

        long time = System.currentTimeMillis();

        try {
            TestprojectitemmonitorService testprojectitemmonitorService = SpringUtil.getBeans("testprojectitemmonitorService");
            entity.setSlowDiseaseStatisticsVos(testprojectitemmonitorService.showTitle(testKindCode, year, Long.valueOf(areaCode), level, null));

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            System.out.println("myThread1 运行时间为：" + (System.currentTimeMillis() - time));
        }

    }
}
